const { Article } = require('../../model/article.js');
const { Comment } = require('../../model/comment.js');
module.exports = async (req, res) => {
	// res.send('欢迎来到博客文章详情页面')
	//接收主页传过来的id
	const id = req.query.id;
	//从文章集合查询对应的数据
	let article = await Article.findOne({_id: id}).populate('auther');
	//查询当前文章所对应的评论信息
	let comments = await Comment.find({aid: id}).populate('uid');
	// res.send(comments);
	// return;
	res.render('home/article', {
		article,
		comments
	})
}